feat: #45 Space Management & Configuration — all 6 chunks#49
Open
feat: #45 Space Management & Configuration — all 6 chunks#49
Conversation
added 5 commits
March 16, 2026 04:49
- Add ResolveCurrentSpace middleware (request->attributes based)
- Add Request::macro('space') in AppServiceProvider
- Share currentSpace + spaces via HandleInertiaRequests
- SpaceAdminController CRUD + SpaceSwitcherController
- Vue pages: Admin/Spaces/Index, Create, Edit (tabs: General, AI Providers, Settings, Danger Zone)
- SpaceSwitcher.vue component + MainLayout integration
- DefaultSpaceSeeder + DatabaseSeeder prepend
- Refactor Space::first() -> request->space() in 6 controllers
- Fix WebhookAdminController 403 via request->space()
- phpstan.neon: ignore macro method.notFound errors
- Pint pass, PHPStan pass, npm build pass
…used after rebase)
…ption, IDOR fix, null abort
- HIGH#1: EnsureUserIsAdmin now gates entire /admin/* group unconditionally
(allows admins and RBAC-role users; permission middleware handles per-route authz)
- HIGH#2: api_config encrypted at rest via Crypt::encryptString/decryptString in Space model;
SpaceAdminController::edit() masks values with '***' before sending to browser;
update() skips overwrite when all values are masked sentinels
- MEDIUM#3: SpaceAdminController::index() uses $request->attributes->get('space')
instead of app('current_space') to match ResolveCurrentSpace binding
- MEDIUM#4: X-Space-Id header resolution restricted to admin users only (IDOR guard)
- MEDIUM#5: ResolveSpace marked @deprecated; ResolveCurrentSpace is canonical
- MEDIUM#6: ResolveCurrentSpace aborts 503 if no space can be resolved (null no longer allowed through)
- LOW#7: SpaceAdminController::destroy() wrapped in DB::transaction with lockForUpdate() to prevent TOCTOU
- LOW#8: Duplicate Space::first() fallback removed from ResolveCurrentSpace
Tests updated to reflect new 503 behavior (no-space = service unavailable) and to
seed a Space fixture where the middleware requires one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#45 Space Management & Configuration
Chunks Completed: 6/6
Chunk 1: Migration + Model Update
description(text, nullable) anddefault_locale(string(10), default 'en') to spaces tablehasColumnguardChunk 2: DefaultSpaceSeeder + ResolveSpace Middleware
firstOrCreatedefault spaceresolve-spacealias in bootstrap/app.phpChunk 3: SpaceAdminController + Routes
Chunk 4: Vue Pages (Index, Create, Edit)
Chunk 5: Space Switcher + Inertia Share
Chunk 6: Tests
Quality Gates
Notes